<?php

// Yii2-rest-rbac
$rbacRoute = require(__DIR__ . '/rbac_route.php');
$V1Route = require(__DIR__ . '/v1_route.php');
$rules = [

    /* oauth2 */
    'POST oauth2/<action:\w+>' => 'oauth2/rest/<action>',
    'GET rbac/<action:\w+>' => 'rbac/<action>',
    'OPTIONS <modules>/<controller>/<action>' => '<modules>/<controller>/<action>',

    /**
     * 用戶
     * */
    ['class' => 'yii\rest\UrlRule',
        'controller' => 'user',
        'pluralize' => true,
        'extraPatterns'=>[
            'POST create' => 'create',
            'GET index' => 'index',
            'GET list' => 'list',
            'GET view' => 'view',
            'GET menu' => 'menu', // 下拉菜单
        ],
    ],
    ['class' => 'yii\rest\UrlRule',
        'controller' => 'site',
        'pluralize' => false,
        'extraPatterns'=>[
            'GET authorize' => 'authorize',

            'GET menu' => 'menu', // 下拉菜单
        ],
    ],
];

return array_merge($rules, $rbacRoute, $V1Route);